From 2699f86f39187494974c5a1a5c4ad22b584e2e67 Mon Sep 17 00:00:00 2001 From: rominique Date: Tue, 30 Apr 2024 18:41:17 +0200 Subject: [PATCH] =?utf8?q?correction=20gr=C3=A2ce=20au=20d=C3=A9ploiement?= =?utf8?q?=20de=20lederailleur.org?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- creation_nouveau_site.yml | 2 +- templates/nginx_http_server.j2 | 3 +-- templates/nginx_paheko_common.j2 | 2 +- templates/nginx_paheko_server.j2 | 2 +- templates/nginx_www_common.j2 | 6 ++---- templates/nginx_www_server.j2 | 3 +-- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/creation_nouveau_site.yml b/creation_nouveau_site.yml index 5f7712e..4759c12 100644 --- a/creation_nouveau_site.yml +++ b/creation_nouveau_site.yml @@ -78,7 +78,7 @@ - name: Générer un certififat avec certbot # noqa : command-instead-of-module become: true - ansible.builtin.command: 'certbot certonly -n --nginx -d {{ SITE }}.{{ DOMAIN }}.{{ TLD }}' + ansible.builtin.command: 'certbot certonly -n --nginx -d {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }}' register: certbot_log ignore_errors: true changed_when: false diff --git a/templates/nginx_http_server.j2 b/templates/nginx_http_server.j2 index e7aa0e0..67c6aaf 100644 --- a/templates/nginx_http_server.j2 +++ b/templates/nginx_http_server.j2 @@ -1,7 +1,6 @@ server { listen 80; - server_name - {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }}; + server_name {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }}; disable_symlinks if_not_owner; access_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/access.log main buffer=32k; error_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/error.log warn; diff --git a/templates/nginx_paheko_common.j2 b/templates/nginx_paheko_common.j2 index a30fd26..f4ae705 100644 --- a/templates/nginx_paheko_common.j2 +++ b/templates/nginx_paheko_common.j2 @@ -1,4 +1,4 @@ -server_name {{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }}; +server_name {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }}; root /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/www; location / { diff --git a/templates/nginx_paheko_server.j2 b/templates/nginx_paheko_server.j2 index e522e3e..8f42629 100644 --- a/templates/nginx_paheko_server.j2 +++ b/templates/nginx_paheko_server.j2 @@ -4,7 +4,7 @@ server { access_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/access.log main buffer=32k; error_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/error.log warn; {% if ssl_ready is defined and ssl_ready %} - return 301 https://{{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }}$request_uri; + return 301 https://$server_name$request_uri; } server { listen 443; diff --git a/templates/nginx_www_common.j2 b/templates/nginx_www_common.j2 index 1168977..831a739 100644 --- a/templates/nginx_www_common.j2 +++ b/templates/nginx_www_common.j2 @@ -1,7 +1,5 @@ -server_name - {{ DOMAIN }}.{{ TLD }} - {{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }}; -rewrite ^/(.*) http://{{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }}/$1 permanent; +server_name {{ DOMAIN }}.{{ TLD }} {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }}; +{# semble ne pas être nécessaire rewrite ^/(.*) http://{{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }}/$1 permanent; #} root /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/; index index.html; diff --git a/templates/nginx_www_server.j2 b/templates/nginx_www_server.j2 index ace724b..fd9ba1f 100644 --- a/templates/nginx_www_server.j2 +++ b/templates/nginx_www_server.j2 @@ -1,11 +1,10 @@ server { listen 80; include /etc/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/common.conf; - server_name {{ DOMAIN }}.{{ TLD }}; access_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/access.log main buffer=32k; error_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/error.log warn; {% if ssl_ready is defined and ssl_ready %} - return 301 https://{{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }}$request_uri; + return 301 https://$server_name$request_uri; } server { listen 443 ssl; -- 2.20.1